<?php
/**
 * Created by PhpStorm.
 * User: jin
 * Date: 2015/9/11
 * Time: 16:19
 */

namespace block;


class File
{
    static function writeFile($fileStr,$path)
    {
        $path_arr=explode('/', $path);
        $temp='';
        $temp_arr=array();
        for ($i=0; $i <count($path_arr)-1 ; $i++) {
            $temp.=$path_arr[$i].'/';
            if ($path_arr[$i]!='.') {
                $temp_arr[]=$temp;
            }
        }

        foreach ($temp_arr as $key => $value) {
            if (!is_dir($value)) {
                mkdir($value);
            }
        }
        //if (substr_count($path,'.html')||!file_exists($path)) {
        file_put_contents($path, $fileStr);
        //}
    }
}